package com.shallowUniverse.process.service;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.shallowUniverse.process.entity.ProcessNodeDefinition;
import com.shallowUniverse.process.exception.ProcessNotCompletedException;

import java.util.List;
import java.util.Map;

/**
 * @author gs
 * @date create in 2020/12/11 16:06
 */
public interface ProcessNodeDefinitionService {
    /**
     * description: 依据流程号提供第一个节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/26 <br/>
     * params: [processId] <br/>
     * return: java.util.List<com.qianyu.process.entity.ProcessNodeDefinition> <br/>
     * version: 1.0
     */
    List<ProcessNodeDefinition> findFirstNode(Long processId);

    /**
     * description: 依据节点提供它下一个节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/26 <br/>
     * params: [processNodeDefinition] <br/>
     * return: java.util.List<com.qianyu.process.entity.ProcessNodeDefinition> <br/>
     * version: 1.0
     */
    List<ProcessNodeDefinition> renderNextNode(ProcessNodeDefinition processNodeDefinition);

    /**
     * description: 通过id获取节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/26 <br/>
     * params: [ids] <br/>
     * return: java.util.List<com.qianyu.process.entity.ProcessNodeDefinition> <br/>
     * version: 1.0
     */
    List<ProcessNodeDefinition> findByIds(List<Long> ids);

    /**
     * description: 查询目标表的需要限制的字段 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [params] <br/>
     * return: java.lang.String <br/>
     * version: 1.0
     */
    String findFieldValue(Map<String, String> params);

    /**
     * description: 保存节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [processNodeDefinition] <br/>
     * return: int <br/>
     * version: 1.0
     */
    int save(ProcessNodeDefinition processNodeDefinition);

    /**
     * description: 批量保存节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [processNodeDefinitions] <br/>
     * return: int <br/>
     * version: 1.0
     */
    int saveBatch(List<ProcessNodeDefinition> processNodeDefinitions);

    /**
     * description: 修改流程节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [processNodeDefinition] <br/>
     * return: int <br/>
     * version: 1.0
     */
    int update(ProcessNodeDefinition processNodeDefinition);

    /**
     * description: 批量更新 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [processNodeDefinitions] <br/>
     * return: int <br/>
     * version: 1.0
     */
    int updateBatch(List<ProcessNodeDefinition> processNodeDefinitions);

    /**
     * description: 根据流程查找节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [processNodeDefinition] <br/>
     * return: java.util.List<com.qianyu.process.entity.ProcessNodeDefinition> <br/>
     * version: 1.0
     */
    List<ProcessNodeDefinition> find(ProcessNodeDefinition processNodeDefinition);

    /**
     * description: 删除节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [ids, isLogic] <br/>
     * return: int <br/>
     * version: 1.0
     */
    int remove(List<Long> ids, boolean isLogic) throws ProcessNotCompletedException;

    /**
     * description: 根据流程逻辑删除节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [processIds, isLogic] <br/>
     * return: int <br/>
     * version: 1.0
     */
    int removeByProcess(List<Long> processIds, boolean isLogic) throws ProcessNotCompletedException;

    /**
     * description: 根据流程id分页查询节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/20 <br/>
     * params: [page, processNodeDefinition] <br/>
     * return: com.baomidou.mybatisplus.core.metadata.IPage<com.qianyu.process.entity.ProcessNodeDefinition> <br/>
     * version: 1.0
     */
    IPage<ProcessNodeDefinition> findPage(IPage<ProcessNodeDefinition> page, ProcessNodeDefinition processNodeDefinition);

    /**
     * description: 根据角色查询最大节点 <br/>
     * author: Shuai Guo   <br/>
     * date: 2021/7/26 <br/>
     * params: [params] <br/>
     * return: java.util.List<com.qianyu.process.entity.ProcessNodeDefinition> <br/>
     * version: 1.0
     */
    List<ProcessNodeDefinition> findMaxNodeByRole(Map<String, String> params);
}
